﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Security.Principal;
using System.Threading;
using System.Configuration;

namespace GTA.ResourceAccess
{
    public class ProprietaryNetworkCredentials : Microsoft.TeamFoundation.Client.ICredentialsProvider
    {
        #region ICredentialsProvider Members

        public System.Net.ICredentials GetCredentials(Uri uri, System.Net.ICredentials failedCredentials)
        {
            String userName = ConfigurationManager.AppSettings["CredentialsUserName"];
            String password = ConfigurationManager.AppSettings["CredentialsPassword"];
            String domain = ConfigurationManager.AppSettings["CredentialsDomain"];
            password = Cryptography.Util.DESCryptographer.Decrypt(password);

            return new NetworkCredential(userName, password, domain);
        }
        public void NotifyCredentialsAuthenticated(Uri uri)
        {
        }

        #endregion
    }
}
